package com.ajun.api.facade;

import com.ajun.common.entity.R;
import com.ajun.entity.Payment;
import com.alibaba.fastjson.JSONObject;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Payment Feign Client
 *
 * @author LiJun
 * @date 2021-07-13
 */
@RestController
@RequestMapping("/api/payment")
@FeignClient(value = "CLOUD-PROVIDER-PAYMENT")
public interface PaymentFeignClient {

    @GetMapping("/discovery")
    R<JSONObject> discovery();

    @PostMapping("/create")
    R<Boolean> createPayment(@RequestBody Payment payment);

    @GetMapping("/get/{id}")
    R<Payment> getPayment(@PathVariable("id") Long id);
}
